<template>
    <section class="integral-record-main base-main">
      <van-tabs v-model="active" animated>
        <van-tab title="全部">
          <pull-up-reload
            :on-infinite-load="onInfiniteLoad"
            :parent-pull-up-state="infiniteLoadData.pullUpState"
            >
            <IntegraGood
              :integralData="integralData"
              @operationlogistics="operationLogistics"
              @confirmorder="confirmOrder"
              @tointegral="toIntegral"
            ></IntegraGood>
          </pull-up-reload>
        </van-tab>
        <van-tab title="待发货">
          <pull-up-reload
            :on-infinite-load="onInfiniteLoad"
            :parent-pull-up-state="infiniteLoadData.pullUpState"
            >
            <IntegraGood
              :integralData="integralData"
              @operationlogistics="operationLogistics"
              @confirmorder="confirmOrder"
              @tointegral="toIntegral"
            ></IntegraGood>
          </pull-up-reload>
        </van-tab>
        <van-tab title="待收货">
          <pull-up-reload
            :on-infinite-load="onInfiniteLoad"
            :parent-pull-up-state="infiniteLoadData.pullUpState"
            >
            <IntegraGood
              :integralData="integralData"
              @operationlogistics="operationLogistics"
              @confirmorder="confirmOrder"
              @tointegral="toIntegral"
            ></IntegraGood>
          </pull-up-reload>
        </van-tab>
        <van-tab title="已完成">
          <pull-up-reload
            :on-infinite-load="onInfiniteLoad"
            :parent-pull-up-state="infiniteLoadData.pullUpState"
            >
            <IntegraGood
              :integralData="integralData"
              @operationlogistics="operationLogistics"
              @confirmorder="confirmOrder"
              @tointegral="toIntegral"
            ></IntegraGood>
          </pull-up-reload>
        </van-tab>
      </van-tabs>
    </section>
</template>

<script type="text/ecmascript-6">
  import PullUpReload from '../../components/PullUpReload.vue'
  import IntegraGood from '../../components/IntegraGood.vue'

  export default {
    components:{
      PullUpReload,IntegraGood,
    },
    data() {
      return {
        active:0,
        integralData:[
          {
            orderNum:'20183546543112',
            status:1,//待付款
            goodList:[
              {
                goodName:'商品名称11',
                goodModel:'商品规格11',
                point:'3200',
                goodNum:2,
                imgPath:'https://ss0.baidu.com/6ONWsjip0QIZ8tyhnq/it/u=130623978,3345737307&fm=85&app=63&f=JPG?w=121&h=75&s=7B84F70E594ECCCE50FDA96E0300607B'
              },
              {
                goodName:'商品名称22',
                goodModel:'商品规格22',
                price:'80.00',
                goodNum:2,
                imgPath:'https://ss0.baidu.com/6ONWsjip0QIZ8tyhnq/it/u=130623978,3345737307&fm=85&app=63&f=JPG?w=121&h=75&s=7B84F70E594ECCCE50FDA96E0300607B'
              },
            ],
            totalPoint:3200,
            totalGoodNum:4,
          },
          {
            orderNum:'20183546543112',
            status:2,//待付款
            goodList:[
              {
                goodName:'商品名称11',
                goodModel:'商品规格11',
                price:'80.00',
                goodNum:2,
                imgPath:'https://ss0.baidu.com/6ONWsjip0QIZ8tyhnq/it/u=130623978,3345737307&fm=85&app=63&f=JPG?w=121&h=75&s=7B84F70E594ECCCE50FDA96E0300607B'
              },
              {
                goodName:'商品名称22',
                goodModel:'商品规格22',
                price:'80.00',
                goodNum:2,
                imgPath:'https://ss0.baidu.com/6ONWsjip0QIZ8tyhnq/it/u=130623978,3345737307&fm=85&app=63&f=JPG?w=121&h=75&s=7B84F70E594ECCCE50FDA96E0300607B'
              },
            ],
            totalPrice:320,
            totalGoodNum:4,
          }
        ],
        page:0,
        // 上拉加载的设置
        infiniteLoadData: {
          initialShowNum: 3, // 初始显示多少条
          everyLoadingNum: 3, // 每次加载的个数
          pullUpState: 0, // 子组件的pullUpState状态
          pullUpList: [], // 上拉加载更多数据的数组
          showPullUpListLength: this.initialShowNum // 上拉加载后所展示的个数
        }
      }
    },
    methods: {
      //查看物流
      operationLogistics(item){

      },
      //确认收货
      confirmOrder(item){

      },
      //
      toIntegral(){
        this.$router.push({
          path:'/index/web/integralExchange'
        })
      },
      // 上拉加载
      onInfiniteLoad (done) {
        if (this.infiniteLoadData.pullUpState === 0) {
//          this.getPullUpMoreData()
        }
        done()
      }
    },
  }
</script>

<style lang="scss">
 @import '../../assets/css/integralRecord.scss';
</style>
